package com.maccman.aireo.command
{
	/* add to controller
	addCommand( DeleteAssetCommandEvent.EVENT_DELETE_ASSET_COMMAND, DeleteAssetCommand );
	*/
	import com.adobe.cairngorm.control.CairngormEvent;
	import com.adobe.cairngorm.commands.ICommand;

	import com.maccman.aireo.model.AireoModelLocator;
	import com.maccman.aireo.control.DeleteAssetEvent;

	import mx.controls.Alert;
	import mx.rpc.IResponder;
	import mx.rpc.events.FaultEvent;
	
	import com.maccman.activeresource.models.Asset;
	import com.maccman.aireo.vo.AssetVO;

	public class DeleteAssetCommand implements ICommand, IResponder
	{
		public function execute(event:CairngormEvent):void
		{
		    var delegate : Asset = new Asset( this );
		    delegate.destroy(DeleteAssetEvent(event).id)
		}
		
		public function result(data:Object):void
		{
			AssetVO.find(data.id).destroy();
		}
		
		public function fault(info:Object):void
		{
			var faultEvent :FaultEvent = FaultEvent( info )
			Alert.show( "fault at DeleteAssetCommand" )
		}
		
	}
}